04. Viewing Modified Files
We just looked at the --oneline
flag to show one commit per line. That's great for getting an overview of the repository. But what if we want to dig in a little to see what file or files were changed by a commit?
What file or files are modified?
SOLUTION:
There's no way to know for suregit log --stat
Intro
The git log
command has a flag that can be used to display the files that have been changed in the commit, as well as the number of lines that have been added or deleted. The flag is --stat
("stat" is short for "statistics"):
$ git log --stat
Run this command and check out what it displays.
![_Two Terminal applications side-by-side. The left one shows the result of the `git log` command with all of the information while the right one shows the result of the `git log --stat` command which lists the files that were changed as well as the number of added/removed lines._](img/ud123-l3-git-log-vs-git-log-stat.png)
Two Terminal applications side-by-side. The left one shows the result of the git log
command with all of the information while the right one shows the result of the git log --stat
command which lists the files that were changed as well as the number of added/removed lines.
Nd016 WebND Ud123 Gitcourse BETAMOJITO L3 33 Git Log Vs Git Log --Stat Walkthru
How Many Files Were Modified?
SOLUTION:
2 filesHow Many Files Were Modified 2?
SOLUTION:
2 filesHow Many Lines Were Modified?
SOLUTION:
4 linesgit log --stat
Recap
To recap, the --stat
flag is used to alter how git log
displays information:
$ git log --stat
This command:
- displays the file(s) that have been modified
- displays the number of lines that have been added/removed
- displays a summary line with the total number of modified files and lines that have been added/removed